package com.jluzh10.learning.domain;


import com.jluzh10.learning.utils.qiniu.QiniuUtil;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Size;
import java.util.Date;

public class User {
    //用户绑定的教学方
    private Teacher teacher;
    
    private Integer id;

    private String username;

    private String password;

    private String mobile;

    private Byte gender;

    private String nickname;

    private String introduction;

    private String head;

    private Date createTime;

    private Byte state;

    private Date loginTime;

    /**
     * 是否记住密码
     */
    private boolean remember;

    public User(Integer id, Date loginTime) {
        this.id = id;
        this.loginTime = loginTime;
    }

    public User() {
    }

    public boolean isRemember() {
        return remember;
    }

    public void setRemember(boolean remember) {
        this.remember = remember;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile == null ? null : mobile.trim();
    }

    public Byte getGender() {
        return gender;
    }

    public void setGender(Byte gender) {
        this.gender = gender;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname == null ? null : nickname.trim();
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction == null ? null : introduction.trim();
    }

    public String getHead() {
        if (head!=null){
            return QiniuUtil.getUrlByHead(head);
        }
        return null;
    }

    public void setHead(String head) {
        this.head = head == null ? null : head.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Byte getState() {
        return state;
    }

    public void setState(Byte state) {
        this.state = state;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", mobile='" + mobile + '\'' +
                ", gender=" + gender +
                ", nickname='" + nickname + '\'' +
                ", introduction='" + introduction + '\'' +
                ", head='" + head + '\'' +
                ", createTime=" + createTime +
                ", state=" + state +
                ", loginTime=" + loginTime +
                '}';
    }
}